import React,{Component} from 'react'

class Counter extends Component {
    constructor(){
        super()
        this.state = {
            counter: 0
        }
    }
    increment(){
        this.setState(prevState=>({
            counter: prevState.counter+1
        }))
    }
    incrementfive(){
        this.increment()
        this.increment()
        this.increment()
        this.increment()
        this.increment()
    }
    render(){
        return (
            <div>
                <h1>This is counter: {this.state.counter}</h1>
                <button onClick={()=>this.incrementfive()}>Increase</button>
            </div>
        )
    }
}

export default Counter